<div class="pt15 pl15">当前位置：<span class="layui-breadcrumb"><a href="/">首页</a><a href="/admin/sys-source/index">资源管理</a></span></div>
  <div class="layui-fluid">
    <div class="layui-card p30">		
		<div class="border-b pb15 f22">资源管理</div>
		<div class="layui-row layui-col-space20 mt">
			<div class="layui-col-xs4 layui-col-sm6 layui-col-md3">
				<a class="layui-btn layui-btn-normal" href="/admin/sys-source/create">添加资源</a>
			</div>
			<div class="layui-col-xs8 layui-col-sm6 layui-col-md9 text-r">
				<form class="layui-form " action="/admin/sys-source/index">					
					<div class="layui-inline">
						<label class="layui-form-label">资源名称</label>
						<div class="layui-input-inline">
						  <input type="text" name="name" value="" placeholder="请输入您要查询的关键字!" class="layui-input">
						</div>
					</div>
					<div class="layui-inline">
					   <button class="layui-btn layui-btn-normal layui-icon layui-icon-search">  搜索</button>
					</div>					  
				</form>
			</div>
		</div>
		<div class="layui-card-body p0 mt15">		 
			<table class="layui-table">					
				<thead>
					<tr>
					  <th>ID</th>
					  <th>名称</th>
					  <th>url</th>
					  <th>菜单</th>
					  <th>上级ID</th>
					  <th>操作</th>
					</tr> 
				</thead>
			  <tbody>
				<?php foreach($data['pagedata'] as $source){?>  
				<tr>
				  <td><?= $source['id'] ?></td>
				  <td><?= $source['name'] ?></td>
				  <td><?= $source['url'] ?></td>
				  <td><?= $source['ismenu']==1 ? '是' : '否'; ?></td>
				  <td><?= $source['parent'] ?></td>
				  <td>
					  <a class="layui-btn layui-btn-normal layui-btn-xs" href="/admin/sys-source/update?id=<?= $source['id']?>"><i class="layui-icon layui-icon-edit"></i>编辑</a>
					  <a class="layui-btn layui-btn-danger layui-btn-xs delete" data-id="<?= $source['id']?>"><i class="layui-icon layui-icon-delete"></i>删除</a>	
				  </td>
				</tr>
				<?php }?>
				</tbody>
			</table>			
			<div class="p-tradelist-pager text-c"><?= $page?></div>		
		</div>
    </div>
  </div>
<script>
$(".delete").on('click',function(){
    var id = $(this).attr('data-id');
    layer.confirm('您确定要删除该条数据', {btn: ['删除', '取消' ]}, function(index, layero){
        $params = JSON.stringify({'id':id});
        second_region_back = ajaxSynchroRequest("/admin/sys-source/delete",$params);
        if(second_region_back.success==1){
            layer.msg(second_region_back.msg);
            layer.close(index);
            window.location.reload();
        }
    });
});
</script>